<?php

class User_Form_ChangeInfo extends Zend_Form {

    /**
     * Form for register user
     * @author Nguyen Manh Hung
     */
    public function init() {
        $this->setAction('')
                ->setMethod('post');

        $title = $this->createElement('select', 'gender');
        $title->setLabel('Gender:')
                ->setMultiOptions(array('1' => 'Male', '0' => 'Female'))
                ->setRequired(true)->addValidator('NotEmpty', true)
                ->setAttrib('class', 'input-text-login');

        $firstName = $this->createElement('text', 'first_name');
        $firstName->setLabel('First name:')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setAttrib('size', 50)
                ->addValidator('stringLength', false, array(3, 100))
                ->addValidator('NotEmpty')
                ->setAttrib('class', 'input-text-login');

        $lastName = $this->createElement('text', 'last_name');
        $lastName->setLabel('Last name:')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setAttrib('size', 50)
                ->addValidator('stringLength', false, array(3, 100))
                ->addValidator('NotEmpty')
                ->setAttrib('class', 'input-text-login');

        $email = $this->createElement('text', 'email');
        $email->setLabel('Email:')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addFilter('StringToLower')
                ->setAttrib('size', 50)
                ->addValidator('EmailAddress')
                ->setAttrib('class', 'input-text-login');

        $avatar = $this->createElement('text', 'avatarurl');
        $avatar->setLabel('Avatar:')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addFilter('StringToLower')
                ->setAttrib('size', 50)
                ->addValidator('stringLength', false, array(0, 100))
                ->setAttrib('class', 'input-text-login');

        $submit = $this->createElement('submit', 'submit');
        $submit->setAttrib('id', 'submit_register');
        $submit->setLabel('Submit');
        $submit->setAttrib('class', 'button');
        $submit->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'hb'), array('Label', array('tag' => '')))));
        $reset = $this->createElement('reset', 'reset', array('label' => 'Reset'));
        $reset->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'hb'), array('Label', array('tag' => '')))));
        $reset->setAttrib('class', 'button');
        $cancel = $this->createElement('submit', 'back', array('label' => 'Cancel'));
        $cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'hb'), array('Label', array('tag' => '')))));
        $cancel->setAttrib('class', 'button');
        $this->addElement($title)
                ->addElement($firstName)
                ->addElement($lastName)
                ->addElement($email)
                ->addElement($avatar)
                ->addElement($submit)
                ->addElement($reset)
                ->addElement($cancel);
    }

}